package feng.process;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import feng.process.base.bean.ProcessBean;
import feng.process.base.bean.StepBean;
import feng.process.base.step.StartStep;
import feng.process.base.step.TaskStep;

/**
 * 流程对象，封装了一个流程的基本信息和各环节信息
 * @author 冯昌硕
 * @create 2012-10-22 下午11:47:41
 */
public class ProcessObject {

    /**
     * 流程名称及模板信息对象
     */
    private ProcessBean processBean;
    
    /**
     * 开始步骤配置数据对象
     */
    private StepBean startStepBean;
    
    /**
     * 流程启动操作类
     */
    private StartStep startStep;
    
    /**
     * 环节步骤解析Bean结果集合
     */
    private List<StepBean> stepBeanLst;
    
    /**
     * 环节处理步骤集合
     * Key：环节id
     * Value：环节操作对象
     */
    private Map<String, TaskStep> taskStepMap;
    
    public ProcessObject() {
        taskStepMap = new HashMap<String, TaskStep>();
    }

    public ProcessBean getProcessBean() {
        return processBean;
    }

    public void setProcessBean(ProcessBean processBean) {
        this.processBean = processBean;
    }

    public StartStep getStartStep() {
        return startStep;
    }

    public void setStartStep(StartStep startStep) {
        this.startStep = startStep;
    }
    
    /**
     * 解析时添加一个环节内容
     * @param id
     * @param taskStep
     * @create 2012-10-29 下午11:59:49
     */
    public void addTask(String id, TaskStep taskStep) {
        taskStepMap.put(id, taskStep);
    }

    public StepBean getStartStepBean() {
        return startStepBean;
    }

    public void setStartStepBean(StepBean startStepBean) {
        this.startStepBean = startStepBean;
    }

    public List<StepBean> getStepBeanLst() {
        return stepBeanLst;
    }

    public void setStepBeanLst(List<StepBean> stepBeanLst) {
        this.stepBeanLst = stepBeanLst;
    }
    
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("processBean=["+ processBean +"] \n");
        sb.append("startStepBean=["+ startStepBean +"] \n");
        sb.append("startStep=["+ startStep +"] \n");
        sb.append("stepBeanLst=["+ stepBeanLst +"] \n");
        return sb.toString();
    }

    public Map<String, TaskStep> getTaskStepMap() {
        return taskStepMap;
    }
}
